home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / LINKLIST.ZIP / LINKCODE.CPP next >
Encoding:
C/C++ Source or Header  |  1996-08-11  |  1.1 KB  |  43 lines

  1. ///////////////////////////////////////////////////////
  2. //                                                   //
  3. //   Linked List Class Functions - Version 1.00      //
  4. //                                                   //
  5. //           By Kevin Campbell 22/7/95               //
  6. //                                                   //
  7. //                                                   //
  8. ///////////////////////////////////////////////////////
  9.  
  10. /*
  11.     This is a piece of example code on how to use the linklist
  12.     library. THis code has been tested with Borland's Turbo C++
  13.     3.0 and should work on most C++ compilers.
  14. */
  15.  
  16. /*
  17.     To use this library, include the linklist files into your project
  18. */
  19.  
  20.  
  21. #include "linklist\linklist.h"
  22. #include <string.h>
  23. #include <stdlib.h>
  24. #include <conio.h>
  25. #include <alloc.h>
  26. #include <stdio.h>
  27.  
  28. #define LINK_SIZE 20
  29.  
  30. main(){
  31.   char temp[LINK_SIZE];
  32.   linked_list<char> names;
  33.   names.add();
  34.   names.put("J");
  35.   names.add();
  36.   names.put("M");
  37.   names.last();
  38.   names.get(temp);
  39.   printf("%s\n",names.addr());
  40.   names.next();
  41.   printf("%s\n",names.addr()); // Addr returns a pointer to the data
  42.   getch();
  43. }